package leecode

func maxVowels(s string, k int) (res int) {
	hashMap := make(map[byte]bool)
	hashMap['a'] = true
	hashMap['e'] = true
	hashMap['i'] = true
	hashMap['o'] = true
	hashMap['u'] = true
	var result int
	left := 0
	for right := 0; right < len(s); {
		if right-left+1 <= k {
			if hashMap[s[right]] {
				result++
			}
			right++
		} else {
			if hashMap[s[left]] {
				//如果窗口左侧元素是元音
				result--
			}
			//当窗口内的元素等于k值了 收紧窗口
			left++
		}

		res = max(result, res)
	}
	return
}
